log using "C:\Users\J.PARK\Dropbox\Discrimination Project_for me\Organizational Diversity\2023 Version_Merging\FINAL\CFA_2015.smcl", replace  

import delimited "C:\Users\J.PARK\Dropbox\DISCRIMINATION PROJECT\FEVS\FEVS_2010-2019\evs2015_PRDF.csv"
drop if q17=="X"
drop if q17==""
drop if q37=="X"
drop if q37==""
drop if q38=="X"
drop if q38==""
drop if q15=="X"
drop if q15==""
drop if q22=="X"
drop if q22==""
drop if q25=="X"
drop if q25==""
drop if q33=="X"
drop if q33==""
drop if q48==.
drop if q49==.
destring q17, replace
destring q37, replace
destring q38, replace
destring q15, replace
destring q22, replace
destring q25, replace
destring q33, replace
drop if q55=="X"
drop if q55==""
drop if q45=="X"
drop if q45==""
drop if q34=="X"
drop if q34==""
destring q55, replace
destring q45, replace
destring q34, replace
drop if dsuper=="X"
drop if dsuper==""
drop if dsex=="X"
drop if dsex==""
drop if dminority==.
gen minority = 0 if dminority==2
replace minority = 1 if dminority==1
gen gender = 1 if dsex == "B"
replace gender = 0 if dsex == "A"
gen supervisor = 1 if dsuper == "B" 
replace supervisor = 0 if dsuper == "A"

svyset [pweight=postwt]

svy linearized : sem (JUSTICE -> DISTRIBUTIVE, ) (JUSTICE -> PROCEDURAL, ) (JUSTICE -> INTERPERSONAL, ) (DISTRIBUTIVE -> q22, ) (DISTRIBUTIVE -> q25, ) (DISTRIBUTIVE -> q33, ) (PROCEDURAL -> q15, ) (PROCEDURAL -> q17, ) (PROCEDURAL -> q37, ) (PROCEDURAL -> q38, )(INTERPERSONAL -> q48, ) (INTERPERSONAL -> q49, ), standardized latent(JUSTICE DISTRIBUTIVE PROCEDURAL INTERPERSONAL ) nocapslatent

estat gof, stats(all)

predict justice, latent(JUSTICE)

svy linearized : sem (DIVERSITY -> q34, ) (DIVERSITY -> q45, ) (DIVERSITY -> q55, ), standardized latent(DIVERSITY) nocapslatent

estat gof, stats(all)

predict diversity, latent(DIVERSITY)

keep if agency =="AM" | agency =="ED" | agency =="DN" | agency =="HU" | agency =="ST" | agency =="EP"  | agency =="FC" | agency =="GS" | agency =="NN" | agency =="NU" | agency =="OM" | agency =="SE" | agency =="SZ" | plevel1 =="DD34" | plevel1 =="DD10" | plevel1 =="DD63" | plevel1 =="DD35" | plevel1 =="DD04" | plevel1 =="DD07" | plevel1 =="DD27" | plevel1 =="DD60" | plevel2 =="AG1001" | plevel2 =="AG0101" | plevel2 =="AG0401" | plevel2 =="AG0501" | plevel2 =="AG0502" |plevel2 =="AG1501" | plevel1 =="CM03"  | plevel1 =="CM08" | plevel1 =="CM09" | plevel1 =="CM14" | plevel1 =="HE04" | plevel1 =="HE05" | plevel1 =="HE06" | plevel1 =="HE08" | plevel1 =="HE09" | plevel1 =="HE10" | plevel1 =="HE12" |plevel1 =="HS04" | plevel1 =="HS14" | plevel1 =="HS01" | plevel1 =="HS03" | plevel1 =="HS02" | plevel1 =="HS06" | plevel1 =="HS12" | plevel1 =="DJ15" | plevel1 =="DJ03" | plevel1 =="DJEA" | plevel1 =="DJ09" | plevel1 =="DJ02" | plevel1 =="DJ08" | plevel1 =="DL03" | agency =="AF" | agency =="AR" | plevel1 =="IN03" | plevel1 =="IN01" | plevel1 =="IN02" | plevel1 =="IN07" | plevel1 =="IN05" | plevel1 =="IN06" | agency =="NV" | plevel1 =="TRFS" | plevel1 =="TR93" | plevel1 =="TRAJ" | plevel1 =="TD03" | plevel1 =="TD04" | plevel1 =="VA03" | plevel1 =="VA02"

svy linearized : sem (JUSTICE -> DISTRIBUTIVE, ) (JUSTICE -> PROCEDURAL, ) (JUSTICE -> INTERPERSONAL, ) (DISTRIBUTIVE -> q22, ) (DISTRIBUTIVE -> q25, ) (DISTRIBUTIVE -> q33, ) (PROCEDURAL -> q15, ) (PROCEDURAL -> q17, ) (PROCEDURAL -> q37, ) (PROCEDURAL -> q38, )(INTERPERSONAL -> q48, ) (INTERPERSONAL -> q49, ), standardized latent(JUSTICE DISTRIBUTIVE PROCEDURAL INTERPERSONAL ) nocapslatent

estat gof, stats(all)

predict justice2, latent (JUSTICE)

svy linearized : sem (DIVERSITY -> q34, ) (DIVERSITY -> q45, ) (DIVERSITY -> q55, ), standardized latent(DIVERSITY) nocapslatent

estat gof, stats(all)

predict diversity2, latent (DIVERSITY)

sum justice, detail

sum justice2, detail

sum diversity, detail

sum diversity2, detail

corr justice justice2

corr diversity diversity2 

log close

